//
//  main.m
//  ModelCreate
//
//  Created by tanxk_mini on 2018/11/19.
//  Copyright © 2018 runzezhihun. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "CDKRequestPort.h"
#import "MDFModelCreate.h"

static NSString *const HostPath = @"/Users/mac/Project/09.PioneerProject/未命名文件夹/automatic_generation_model_ios/自动生成请求模型/ModelCreate/Models";
static NSString *const SwaggerURL = @"http://www.51miaoqian.com:8081/v2/api-docs";

void createModelWithItem()
{
    NSLog(@"脚本开始运行");
    [[CDKRequestPort shared] setHostPath:HostPath];
    NSString *str = [[CDKRequestPort shared] printPort:SwaggerURL];
    
    [[MDFModelCreate shared] setHostPath:[NSString stringWithFormat:@"%@/",HostPath]];
    [[MDFModelCreate shared] createPortFileM:@"port" string:str];
    
    NSLog(@"脚本运行结束，请前往%@",HostPath);
}

NSString *mdf_scanf(NSString *string) {
    
    char str[65535];
    
    strcpy(str,(char *)[string UTF8String]);
    
    NSLog(@"\n请输入%@:",string);
    
    scanf("%[^\n]", str);
    
    NSString *tempStr = [NSString stringWithUTF8String:str];
    
    return tempStr;
}

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        
        createModelWithItem();
    }
    
    return 0;
}
